<?php

namespace app\common\traits;


use app\common\loader\ModelMerchant;
use app\common\loader\Services;

/**
 * 商户充值相关
 */
trait RechargeTrait
{


    /**
     * 充值记录
     * @param array $option
     * @return mixed
     * @throws \think\Exception
     */
    public function balanceLog(array $option)
    {
        $payList = ModelMerchant::RechargeLog()->pageList($option['where'], $option['page_size']);
        Services::Helper()->showListTitle($payList['data'], ['merchant_info' => 'mer_id', 'merchant' => 'op_user'], ['pay_way' => 'system.pay_way', 'pay_status' => 'system.pay_status']);
        return $payList;
    }


    /**
     * 充值详情记录
     * @param array $option
     * @return array|\think\Model|null
     * @throws \think\Exception
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function rechargeInfo(array $option)
    {
        $info = ModelMerchant::RechargeLog()->find($option);
        Services::Helper()->showInfoTitle($info, ['merchant_info' => 'mer_id', 'merchant' => 'op_user'], ['pay_way' => 'system.pay_way', 'pay_status' => 'system.pay_status']);
        return $info;

    }

}